from numpy import *
import matplotlib.pyplot as plt

def set_ax(plt):
    ax = plt.gca()
    ax.xaxis.set_ticks_position('bottom')
    ax.yaxis.set_ticks_position('left')
    ax.spines['bottom'].set_position(('data', 0))
    ax.spines['left'].set_position(('data', 0))
    ax.spines['right'].set_color('none')
    ax.spines['top'].set_color('none')
    
def plt_plot(x, y):
    set_ax(plt)
    plt.plot(x,y,color='b')
    plt.show()
    
def plt_dot(x, y):
    plt.grid(True)
    plt.scatter(x,y,color='b')
    plt.show()

def g(t, tao):
    rtn = []
    for x in t:
        if  -2/tao <= x <= 2/tao: rtn.append(1)
        else: rtn.append(0)
    return rtn
    
def r(t):
    rtn = []
    for x in t:
        if  x < 0: rtn.append(0)
        else: rtn.append(x)
    return rtn

if __name__=='__main__':
    t = arange(-5, 5 ,0.01)
    # t = arange(-15, 15 ,0.01)
    
    # f = sin(t)

    # f = 5 * sin(0.5*t-0.3)

    # f = 0.3*e**(0.5*t)
    # f = 0.3*e**(-0.5*t)
    f = 0.3*e**((-0.5+1j)*t)

    # f = sin(t) / t
    # f = g(t, 0.5)
    # f = r(t)
    
    # plt_dot(t, f)
    plt_plot(t, f)
    
    